<?php
/*
 * Quark PHP Framework
 * Copyright 2011, Sahib Alejandro Jaramillo Leo.
 * http://quarkphp.com/
 * Licensed under the GNU General Public License (http://www.gnu.org/licenses/gpl.html).
 */
/**
 * Definicion de clase Css
 * @filesource
 */
/**
 * Clase para incluir archivos CSS en el documento, una instancia de esta clase existe en View (View->Css)
 * @author sahib
 */
class Css extends HtmlFileElementsHandler {

	/**
	 * Constructor
	 * @access public
	 * @return Css
	 */
	public function __construct( ) {

		parent::__construct( Config::get( 'css_path' ) );
	}

	/**
	 * (non-PHPdoc)
	 * @see HtmlElementsHandler::write()
	 */
	public function write( $resource, $return = FALSE ) {

		$media = 'all';
		if( is_array( $resource ) ) {
			$resource = $resource[0];
			$media = $resource[1];
		}
		$html = sprintf( '<link rel="stylesheet" type="text/css" href="%s/%s" media="%s">', $this->src_path, $resource, $media ) . "\n";
		
		if( $return )
			return $html;
		else
			echo $html;
	}
}